import request from '@/router/axios'
import {
  approveStatus,
  getApproveStatus,
  getMappingStatus,
  getStationName,
  numToTwoPoint
} from "../../../../subwayRat/commonCheck";
import moment from 'moment';
export function get_xw_ReportErrorList(query) {
  return request({
    url: '/check/xw/get_xw_ReportErrorList',
    method: 'post',
    params: query
  })
}

export function add_xw_sq_ReportError(query) {
  return request({
    url: '/check/xw/add_xw_sq_ReportError',
    method: 'post',
    params: query
  })
}

export function addAndSubmit_xw_sq_ReportError(query) {
  return request({
    url: '/check/xw/addAndSubmit_xw_sq_ReportError',
    method: 'post',
    data: query,
    //params: query
  })
}

export function update_xw_ReportPromise(query) {
  return request({
    url: '/check/xw/update_xw_ReportPromise',
    method: 'post',
    params: query
  })
}

/**
 * 提交数据
 * @param query
 */
export function submit_xw_ReportPromise(query) {
  return request({
    url: '/check/xw/submit_xw_ReportPromise',
    method: 'post',
    data: query
    //params: query
  })
}

/**
 * 删除数据
 * @param query
 */
export function deleteReportGGSQ(query) {
  return request({
    url: '/check/xw/deleteReportGGSQ',
    method: 'post',
    params: query
  })
}


export const XW_SQ_tableOption={
  editBtn:false,
  delBtn:false,
  addBtn:false,
  border: true,
  stripe: true,
  emptyBtn:false,
  index:true,
  indexLabel:'序号',
  page:true,
  align:'center',
  menuWidth:150,
  menuAlign:'center',
  selection: true,
  reserveSelection:false,
  height: 450,
  column:[
    // {prop:"lineCode", label:"线路",type:'select',search:true,searchslot:true,formatter: function(row, value , label, column){
    //     return getLineName(value);
    //   }},
    // {prop:"stationCode", label:"车站",search:true,searchslot:true,formatter: function(row, value , label, column){
    //     return getStationName(value);
    //   }},
    {prop:"applyTime" ,label:"申请时间",format:'yyyy-MM-dd',width: 90,formatter:function (row,v) {
        return moment(v).format('YYYY-MM-DD');
      }},
    {prop:"reprotTime", label:"报表时间",format:'yyyy-MM-dd',width: 90,formatter:function (row,v) {
        return moment(v).format('YYYY-MM-DD');
      }},
    {prop:"errorClassification",label:"差错类别",formatter:function (row,v) {
      return getMappingStatus('ERROR_CLASSIFICATION',v);
    }},
    // {prop:"errorAmount", label:"差异金额",formatter:function (row,v) {
    //       return numToTwoPoint(v);
    //   }},
    {prop:"applyReason", label:"申请原因",width: 160},
    {prop:"reportName", label:"报表名称",width: 90},
    {
      prop:"creatorName",
      label:"申请人",
      search:true,
      params: {
        userCodeKey: "creatorCode"
      },
      component: "user-select"
    },
    {prop:"creatorCode", label:"申请人员工号",width: 100},
    {prop:"checkStatus", label:"审批状态",type:'select',search:true,dicData:approveStatus(),formatter:function(row,value){
        return getApproveStatus(value);
      }},
    {prop:"modifyLimitTime", label:"修改期限(天)",width: 100},
    {prop:"modifyTime", label:"更改日期",format:'yyyy-MM-dd',width: 90,formatter:function (row,v) {
        return moment(v).format('YYYY-MM-DD');
      }},
    {prop:"isModify", label:"修改状态",
      dicData: [{
        label: '未完成',
        value: '0'
      },{
        label: '修改中',
        value: '2'
      }, {
        label: '已完成',
        value: '1'
      }]
      // formatter:function(row,value){
      //   return value==0?'否':(value==1?'是':'');
      // }
    },
    {prop:"remark" ,label:"备注",width: 160}
    ]
}
